<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>花语花坊</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/login.css"/>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/normalize.css"/>
    <script src="${pageContext.request.contextPath}/static/js/jquery.min.js"></script>
</head>
<body>
<header>
    <div class="logo" ><a href="${pageContext.request.contextPath}/member/getindex"></a></div>
    <b></b>
    <form class="input-group" action="${pageContext.request.contextPath}/product/findproductListSelect" method="post">
        <input class="form-control" name="SelectName" type="text" placeholder="商品关键词" name="keyword"/>
        <span class="input-group-btn">
			    <button id="test"  class="btn btn-primary" type="submit" >搜索</button>
		</span>
    </form>
    <div class="questionnaire">
        <span class="ico ico-phone"></span>
        <a style="margin-right: 20px;">400-889-8188</a>
        |
        <span style="margin-left: 20px;" class="ico ico-headset"></span>
        <a>在线客服</a>
    </div>
</header>
<div class="loginarea">
    <div class="tips-wrapper">
    </div>
    <div class="login-wrap">
        <div class="login-bg">
            <div class="login_form">
                <ul class="login-tab">
                   <a style="margin-left: 80px" href="#">找回密码</a>
                </ul>
                <div class="login-w">

                    <div class="login-bd" style="margin-top: 60px">
                        <form>
                            <div class="login_uname" style="margin-top: 60px">
                                <label style="background: url(${pageContext.request.contextPath}/static/images/common_z.png) no-repeat;background-position: -301px -306px;">

                                </label>
                                <input type="text" id="email" placeholder="请输入注册使用的邮箱">
                            </div>
                            <button style="margin-top: 80px" type="button" class="over" onclick="sendMail();">提交</button>
                        </form>
                    </div>
                </div>
                <div class="login-bd" style="margin-top: 200px">
                    <a href="${pageContext.request.contextPath}/getlogin" class="gotoregist"><i></i>返回登录</a>
                </div>
            </div>
        </div>
    </div>
</div>
<%@include file="/elements/login_bottom.html"%>
</body>
<script>
    function sendMail(){//发送邮箱ajax请求
        var pathName=document.location.pathname;
        console.log("pathName="+pathName);
        //alert("pathName="+pathName);
        var index=pathName.substr(1).indexOf("/");
        var result=pathName.substr(0,index+1);
        console.log(result);

        var email  = $("#email").val();
        console.log(email);
        alert(email);
        if(email == null || email == ""){
            alert("邮箱不能为空");
            return;
        }

        var postData = {
            "email":email
        }
        // ajax后端数据请求
        $.ajax({
            type : "post",
            url : result+"/member/sendMail",
            data : postData,
            dataType:"json",
            success : function(data) {
                if(data.msg=="success"){
                }else if (data.msg=="fail"){
                    alert("邮箱输入错误！没有此邮箱账号，请重新输入。。。。。")
                }
            },
            error : function(data) {
                alert("发生异常！"+data);
            }
        });
    }
</script>
